package Io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
/**
 * 向文件中写入文本数据
 */
public class WriteString {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("./fos.txt",true);
//        String line = "还记得你说家是唯一的城堡";
//        byte[] bytes = line.getBytes(StandardCharsets.UTF_8);  //将字符串转UTF-8存入数组
//        fos.write(bytes);
        fos.write("baby情话多说一点".getBytes(StandardCharsets.UTF_8));
        fos.write("多爱你一点".getBytes(StandardCharsets.UTF_8));
       System.out.println("x写入完毕");
        fos.close();
    }
}
